<?php

$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'defaultRoute' => 'site',
    'bootstrap' => ['log'],
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => '107lab',
        ],
        //缓存，FileCache文件缓存
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'user' => [
//            'identityClass' => 'app\models\Auser',
            'identityClass' => 'app\modules\admin\models\User',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => require(__DIR__ . '/db.php'),
        'car' => [
            'class'=>'app\controllers\Car'
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,  //改为/形式
            'showScriptName' => false, //去掉index.php 同时需要创建.htaccess文件
            'suffix' => '.html',//在后面加.html后缀
            'rules' => [ //编写规则

            ],
        ],

    ],
    'modules' => [
        'forum' => [//模块id对应文件名
            'class' => 'app\modules\forum\Module',//模块中的类
        ],
        'article' => [
            'class' => 'app\modules\article\Article',
        ],
        'comment' => [
            'class' => 'app\modules\comment\Comment',
        ],
        'admin' => [
            'class' => 'app\modules\admin\Admin',
        ],
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}

return $config;
